#!/bin/bash
#
# Copyright (C) 2013-2021 Spring Studio
# Copyright (C) 2013-2021 Dou Dongchun <doudongchun@163.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

########### library variables ##########
URI=
GIT=https://gitee.com/springstudio/curl.git
COMMIT=curl-8_1_2
LOCAL=curl

########### build library ##########

build_arch()
{
  ./buildconf

  rm -rf build
  mkdir build
  cd build

  # cmake \
  #   -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake \
  #   -DCMAKE_INSTALL_PREFIX=$PREFIX \
  #   -DCMAKE_BUILD_TYPE=Release \
  #   -DANDROID_PLATFORM=$API \
  #   -DANDROID_ABI=$ABI \
  #   -DANDROID_NDK=$ANDROID_NDK \
  #   -DANDROID_TOOLCHAIN=clang \
  #   -DBUILD_SHARED_LIBS=ON \
  #   ..

  # --with-openssl [--with-zlib --with-pic --enable-debug --disable-shared --without-ssl --with-gnutls --with-wolfssl]
  ../configure --with-openssl=$PREFIX --with-zlib \
    --prefix=$PREFIX \
    --host=$TARGET \
    --with-sysroot=$SYSROOT

  make clean
  make -j4 -s
  make install

  cd -
}

clear_arch() {
  if [ -d build ]; then
    cd build && make clean && cd -
    rm -rf build
  fi
}

############# forbid modify ###########

. ./tools/do-compile.sh
